Before We Get Started…

Please go to the following site to vote:

http://etc.ch/qJqU

Part 1: knitr and R Markdown

Introduction

Example

Part 2: Creating a Website


Introduction

Even until a couple of years ago, creating a website along with a blog that embeded both code and text, required specific knowledge of HTML. Tools such as markdown and R Markdown, have abstracted the difficult part of writing HTML code for us, so that we can focus on content and creating reproducible analyses. Building on these very tools, the blogdown package by Yihue Xie has made it that much easier to create websites that allow you to showcase your scripts, code and reports, while also maintaining a public portfolio, i.e., having an online presence.

In this part, we will create a minimal working example of a blogdown website. I have provided detailed screenshots of each step. Note: the screenshots provided here are from a Linux operating system, however it will be similar on a Windows or Mac.


Requirements

install.packages("pacman")
pacman::p_load(knitr, rmarkdown, pander, ggplot2, cowplot)
pacman::p_load_gh('rstudio/blogdown')


Step 1: Create 2 git repos

Step 2: Install Hugo

(Note for Mac Users: the first time I installed Hugo, you might need to install homebrew).

library(blogdown)
blogdown::install_hugo(force = TRUE)
blogdown::hugo_version()

Choose a theme

Choose a theme from https://themes.gohugo.io/ and find the link to the theme’s GitHub repository.

blogdown::new_site(theme = "gcushen/hugo-academic", theme_example = TRUE)

After this is complete, you should quit and then reopen the project. Upon reopening, RStudio will recognize the project as a website.

Step 3: Publish website

config.toml - The configuration file for your website. This file tells Hugo how it should render your site, as well as define its menus, and set various other site-wide parameters. This file will look different for every theme, but they will all contain some basic components. baseurl set this to the desired URL for your site, in this case baseurl = “https://.github.io/” title set the title for your new site. Some completely random and objective examples include “Real Leaks, Fake News”, “Gravy Fries and Putin”, and “Kellyanne’s Alternative Factory” description a brief description or mission of your new site, something like “Democracy Described in Data” or “Hair and Imbalanced” theme this should list the theme you specified when creating the site publishDir tell blogdown which directory it should place the rendered site in. This directory will include a copy of everything that gets generated in the public/ directory of your site’s root directory. To use the two repository method described above, set this to publishDir = “../.github.io”. Adjust this path to where ever you keep your .github.io repository

publishDir is relative to current directory. so can use ../ , or use full path “/home/sahir/git_repositories/cssc2018.github.io” but dont use “~/git_repositories/cssc2018.github.io”

Step 4: Create blog post

Part 3: Project pages

Introduction

Example

Acknowledgements